﻿<Window x:Class="SlaktDataReader.Wins.winBook"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:SlaktDataReader"
        DataContext="{Binding RelativeSource={RelativeSource self}}"
        Title="Bok" Height="550" Width="780" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded">
    <Window.Resources>
        <local:CountyParentsLocationCodeConverter x:Key="cConv" />
        <DataTemplate x:Key="Counties">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=LocationName}" FontWeight="Bold"/>
                <TextBlock Text="  (" />
                <TextBlock Text="{Binding Converter={StaticResource cConv}}" />
                <TextBlock Text=")" />
            </StackPanel>
        </DataTemplate>
        
    </Window.Resources>
    <Grid Background="{StaticResource BG1}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="180" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="50" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="70" />
            <RowDefinition Height="80" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Background="{Binding Path=BookColor}" Width="75" HorizontalAlignment="Left">
            <TextBlock Text="{Binding Path=BookCode}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontFamily="Garamond" FontSize="48" />
        </Grid>
        
        <TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Bok:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Typ:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Plats:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Fil:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Reg.av:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Period:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="6" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Licens:" Style="{StaticResource StdLabels}" />
        <TextBlock Grid.Column="0" Grid.Row="7" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Text="Källa:" Style="{StaticResource StdLabels}" />
        
        <TextBox Grid.Column="1" Grid.Row="0" Margin="10,0,10,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.FriendlyName}" />

        <TextBox Grid.Column="1" Grid.Row="3" Margin="10,0,115,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.FileName}" />
        <Button Name="bFindFile" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10,0,10,8" 
                Height="30" Width="100" Click="bFindFile_Click">Öppna...</Button>
        
        <TextBox Grid.Column="1" Grid.Row="4" Margin="10,0,10,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.Author}" />
        <TextBox Grid.Column="1" Grid.Row="5" Margin="10,0,10,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.Period}" />
        <TextBox Grid.Column="1" Grid.Row="6" Margin="10,0,10,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.License}" />
        <TextBox Grid.Column="1" Grid.Row="7" Margin="10,0,10,8" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Path=bk.Source}" />
        
        
        <ComboBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom" Margin="10,0,10,10" Name="cbParents" 
                  ItemsSource="{Binding Path=Counties}" SelectedValuePath="LocationID" 
                  SelectedValue="{Binding Path=bk.Location, Mode=TwoWay}" ItemTemplate="{StaticResource Counties}" TextSearch.TextPath="Counties"/>
        <!-- DisplayMemberPath="LocationName" -->

        <WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1">
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Födselbok" IsChecked="{Binding Path=IsBirthBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Dödsbok" IsChecked="{Binding Path=IsDeathBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Vigselbok" IsChecked="{Binding Path=IsMarriageBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Inflyttning" IsChecked="{Binding Path=IsMoveInBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Utflyttning" IsChecked="{Binding Path=IsMoveOutBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Husförhör" IsChecked="{Binding Path=IsHouseCallBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="BoU" IsChecked="{Binding Path=IsBoUBook, Mode=TwoWay}" />
            <RadioButton Margin="10" VerticalAlignment="Bottom" Foreground="White" FontSize="16" Content="Domsaga" IsChecked="{Binding Path=IsJuridicalBook, Mode=TwoWay}" />
            <TextBlock Height="23" Name="textBlock1" Text="{Binding ElementName=cbParents, Path=Error}" Foreground="White" />
        </WrapPanel>
        
        <StackPanel Grid.Column="1" Grid.Row="8" HorizontalAlignment="Right" Margin="10" Orientation="Horizontal">
            <Button Name="bGoto" Width="100" Height="24" Content="Gå till..." Margin="6" Click="bGoto_Click"/>
            <Button Name="bClose" Width="100" Height="24" Content="Avbryt" Margin="6" Click="bClose_Click"/>
            <Button Name="bOk"  Width="100" Height="24" Content="Ok" Margin="6,6,0,6" Click="bOk_Click"/>
        </StackPanel>
        
    </Grid>
    
</Window>
